package org.jeecg.modules.system.execute;

import cn.hutool.core.collection.ListUtil;
import org.jeecg.common.constant.YsReptileConstant;
import org.jeecg.common.dto.YctdInfoDTO;
import org.jeecg.common.hepler.DingDingHelper;
import org.jeecg.common.template.BaseExecute;
import org.jeecg.common.util.HttpClientDownPage;
import org.jeecg.common.util.TwoTuple;
import org.jeecg.modules.system.util.ZYCTDDataUtil;
import org.jsoup.Jsoup;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 药材核心处理方法
 */
@Component
public class ZYCTDBaseExecute implements BaseExecute {

    @Resource
    private DingDingHelper dingDingHelper;

    @Override
    public List baseExecute() {
        String btcText = HttpClientDownPage.sendGet(YsReptileConstant.ZYCTD_URL);
        List<YctdInfoDTO> yctdInfoDTOS = ZYCTDDataUtil.marketAlertList(Jsoup.parse(btcText));
        //发送到钉钉
        try {
            dingDingHelper.sendData(yctdInfoDTOS);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return yctdInfoDTOS;

    }

    @Override
    public List baseExecute(Object data) {
        return null;
    }

    @Override
    public Object objectExecute(Object data) {
        return null;
    }

    @Override
    public TwoTuple twoTupleExecute(Object data) {
        return null;
    }

    @Override
    public Object objectsExecute(Object data) {
        return null;
    }
}
